package com.chenxi.vhr.convert;

import com.chenxi.vhr.utils.DateUtil;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

import java.text.ParseException;
import java.util.Date;

/**
 * @author : zhangchenxi
 * @create : 2022-02-13
 **/
@Component
public class DateConverter implements Converter<String, Date> {

    @Override
    public Date convert(String source) {
        try {
            return DateUtil.asDate(source);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }
}
